// 创建公共模块 (common.js)
// static/js/common.js

// 切换密码可见性
export function setupPasswordToggle() {
    document.querySelectorAll('.toggle-password').forEach(icon => {
        icon.addEventListener('click', function() {
            const input = this.previousElementSibling.previousElementSibling;
            const type = input.getAttribute('type') === 'password' ? 'text' : 'password';
            input.setAttribute('type', type);
            this.classList.toggle('fa-eye');
            this.classList.toggle('fa-eye-slash');
        });
    });
}

// 检查用户是否已登录
export function isLoggedIn() {
    return localStorage.getItem('isLoggedIn') === 'true';
}


// 获取CSRF token
//export function getCsrfToken() {
//    return document.querySelector('[name=csrfmiddlewaretoken]').value;
//}

